home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 5_10.lha / 5_10 / 5_10c3.h < prev    next >
C/C++ Source or Header  |  1993-08-08  |  661b  |  29 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / Get the type and address back for a given variable.
  6. / Also return an indication of whether we had to
  7. / allocate the variable here.
  8. include <string.h>
  9. nt tableentry::getvardata(char *nm, vardata **addr)
  10.  
  11.    name *n = tbl->lookfor(nm);
  12.  
  13.    // name not found, allocate its data now
  14.    if (!n)
  15. {
  16. // the last char is the type of the variable
  17. char *lastchar = strchr(nm, '\0') - 1;
  18. *addr = settype(nm, *lastchar);
  19. return 1;
  20. }
  21.  
  22.    // the name is there, return its data
  23.    else
  24. {
  25. *addr = (vardata*)(n->pvalue);
  26. return 0;
  27. }
  28.  
  29.